/*
 * @Author: wuqingchun
 * @Date: 2024-04-23 09:42:28
 * @Description: 类对象内存布局
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-04-23 11:05:43
 */
#ifndef __CLASS_MEMORY_LAYOUT_H__
#define __CLASS_MEMORY_LAYOUT_H__

#include <iostream>

class CMemoryLayout
{
private:
    static int m_iStatic;
private:
    int m_iValue = 0x11223344;
public:
    void SetValue(int iValue)
    {
        m_iValue = iValue;
    }

    int GetValue()
    {
        return m_iValue;
    }
    
    virtual void Print01()
    {
        std::cout << "CMemoryLayout::Print01" << std::endl;
    }

    virtual void Print02()
    {
        std::cout << "CMemoryLayout::Print02" << std::endl;
    }
};

int CMemoryLayout::m_iStatic = 0;

class CMemoryLayoutDerived : public CMemoryLayout
{
private:
    int m_iValue1 = 0xaabbccdd;
public:
    virtual void Print02()
    {
        std::cout << "CMemoryLayoutDerived::Print02" << std::endl;
    }

    virtual void Print03()
    {
        std::cout << "CMemoryLayoutDerived::Print03" << std::endl;
    }
};

#endif //__CLASS_MEMORY_LAYOUT_H__